package com.adayo.memoryfree.base;

import android.app.Application;
import android.content.Context;

import com.adayo.memoryfree.exceptions.BaseExceptionHandler;
import com.adayo.memoryfree.exceptions.LocalFileHandler;
import com.adayo.memoryfree.utils.JPreferenceKit;


public abstract class BaseApplication extends Application {
	public static Context applicationContext;
	public JPreferenceKit sharedPreferences;

	@Override
	public void onCreate() {
		super.onCreate();
		applicationContext = getApplicationContext();
		if (getDefaultUncaughtExceptionHandler() == null) {
			Thread.setDefaultUncaughtExceptionHandler(new LocalFileHandler(
					applicationContext));
		} else {
			Thread.setDefaultUncaughtExceptionHandler(getDefaultUncaughtExceptionHandler());
		}
		JPreferenceKit.getInstance().init(this);
		sharedPreferences = JPreferenceKit.getInstance();
	}

	public abstract BaseExceptionHandler getDefaultUncaughtExceptionHandler();
}
